import { ContentTypeEnum } from '@/enums/httpEnum';
import { request } from '@/utils/http';

const LOGIN = '/api/v1/auth/login';
const LOGIN_OUT = '/api/v1/auth/logout';
const REFRESH_TOKEN = '/api/v1/auth/refresh/token';
const CAPTCHA = '/api/v1/auth/captcha';

/**
 * 登录
 * @param params
 */
export function login(params: LoginParams) {
  return request.Post<LoginModel>(LOGIN, params);
}

/**
 * 登出
 */
export function logout() {
  return request.Post(LOGIN_OUT, {});
}

/**
 * 刷新token
 */
export function refreshToken() {
  return request.Post<LoginModel>(REFRESH_TOKEN, {});
}

/**
 * 获取验证码
 * @param params
 */
export function getCaptcha() {
  return request.Get<CaptchaModel>(CAPTCHA, {
    meta: {
      ignoreAuth: true,
    },
  });
}
